package com.chinacoal.microservice;

import com.chinacoal.microservice.fallback.BuildingInformationClientFallback;
import com.chinacoal.microservice.pojo.CcmsSmartleasingBuilding;
import com.chinacoal.microservice.util.QueryCriteria;
import com.chinacoal.microservice.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 房源管理-楼宇信息
 * @date 2020-11-06 17：22
 */
@FeignClient(name = "${spring.application.name}",fallback = BuildingInformationClientFallback.class,configuration = FeignAutoConfiguration.class)
@Api(tags = {"房源管理-楼宇信息"})
public interface BuildingInformationClient {

    /**
     * @author zhuliang
     * @Description: 根据楼宇名模糊查询(带分页)
     * @date 2020-11-09 11：18
     */
    @ApiOperation(value = "根据楼宇名模糊查询(带分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/buildingInformation/likeBuildingName")
    public Result<List<CcmsSmartleasingBuilding>> getLikeBuildingName(@RequestBody QueryCriteria queryCriteria,
                                                                      @RequestHeader("token") String token);

    /**
     * @author zhuliang
     * @Description: 查询所有的楼宇信息(带分页)
     * @date 2020-11-09 13：50
     */
    @ApiOperation(value = "查询所有的楼宇信息(带分页)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "queryCriteria", value = "查询条件", required = true, dataType = "QueryCriteria"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/buildingInformation/allHouses")
    public Result<List<CcmsSmartleasingBuilding>> getAllHouses(@RequestBody QueryCriteria queryCriteria,
                                                               @RequestHeader("token") String token);

    /**
     * @author zhuliang
     * @Description: 根据楼宇id查询对应的楼宇信息
     * @date 2020-11-09 13：57
     */
    @ApiOperation(value = "根据楼宇id查询对应的楼宇信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkBuildingId", value = "楼宇id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/buildingInformation/housesById/{pkBuildingId}")
    public Result<CcmsSmartleasingBuilding> getHousesById(@PathVariable(value = "pkBuildingId") String pkBuildingId,
                                                          @RequestHeader("token") String token);

    /**
     * @author zhuliang
     * @Description: 添加楼宇信息
     * @date 2020-11-09 14：20
     */
    @ApiOperation(value = "添加楼宇信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "building", value = "楼宇实现类型", required = true, dataType = "CcmsSmartleasingBuilding"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PostMapping("smartleasing/buildingInformation/addHouses")
    public Result addHouses(@RequestBody CcmsSmartleasingBuilding building,
                            @RequestHeader("token") String token);

    /**
     * @author zhuliang
     * @Description: 修改楼宇信息
     * @date 2020-11-09 14：38
     */
    @ApiOperation(value = "修改楼宇信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "building", value = "楼宇实现类型", required = true, dataType = "CcmsSmartleasingBuilding"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @PutMapping("smartleasing/buildingInformation/updateHouses")
    public Result updateHouses(@RequestBody CcmsSmartleasingBuilding building,
                               @RequestHeader("token") String token);

    /**
     * @author zhuliang
     * @Description: 根据楼宇id删除对应的楼宇信息
     * @date 2020-11-09 14：52
     */
    @ApiOperation(value = "根据楼宇id删除对应的楼宇信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "path", name = "deleteId", value = "要删除的id字符串", required = true, dataType = "String")
    })
    @DeleteMapping("smartleasing/buildingInformation/deleteHouses/{deleteId}")
    public Result deleteHouses(@RequestHeader("token") String token,
                               @PathVariable(value = "deleteId",required = false) String deleteId);

    /**
     * @Description: 查询所有的楼宇信息
     * @author zhuliang
     * @date 2020/11/12 13:49
     */
    @ApiOperation(value = "查询所有的楼宇信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/buildingInformation/getAll")
    public Result<List<CcmsSmartleasingBuilding>> getAll(@RequestHeader("token") String token);

    /**
     * @Description: 根据楼宇id查询所有的省市区街道，房间
     * @author zhuliang
     * @date 2020/11/12 14:07
     */
    @ApiOperation(value = "根据楼宇id查询所有的省市区街道，房间")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "pkBuildingIds", value = "楼宇id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/buildingInformation/getAllAreaNumber/{pkBuildingIds}")
    public Result<CcmsSmartleasingBuilding> getAllByBuildingId(@PathVariable(value = "pkBuildingIds",required = false) String pkBuildingIds,
                                                               @RequestHeader("token") String token);

    /**
     * @Description: 根据区域编号id查询楼宇信息
     * @author zhuliang
     * @date 2020/12/2 18:27
     */
    @ApiOperation(value = "根据区域编号id查询楼宇信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "areaNumberId", value = "区域编号id", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "令牌", required = true, dataType = "String")
    })
    @GetMapping("smartleasing/buildingInformation/getAllByAreaNumberId/{areaNumberId}")
    public Result<List<CcmsSmartleasingBuilding>> getAllByAreaNumberId(@PathVariable(value = "areaNumberId") String areaNumberId,
                                                                       @RequestHeader("token") String token);

}
